<template>
	<view>
		<view style="display: flex;justify-content: right;">
			<text @click="record">充值记录</text>
		</view>
		<view style="display: flex;">
			<image :src="user.userImage" mode="aspectFit" style="width: 75px; height: 75px;"></image>
		<view style="display: flex;flex-direction: column; padding-left: 10%;">
			<text>昵称:{{user.userName}}</text>
			<text>账号:{{user.userAccount}}</text>
			<text>手机号:{{user.userPhone}}</text>
			<text>余额:{{user.userMoney}}</text>
		</view>
		</view>
		<uni-grid :column="3">
			<uni-grid-item v-for="(item,index) in moneylist" :key="index">
				<view style="display: flex;justify-content: center;align-items: center; height: 100%;">
					<text style="font-size: 24px;" @click="directional(index)">{{item}}元</text>
				</view>
			</uni-grid-item>
			<uni-grid-item>
				<view style="display: flex;justify-content: center;align-items: center; height: 100%;">
					<text  style="font-size: 24px;" @click="other">其他金额</text>
				</view>
			</uni-grid-item>
		</uni-grid>
		<uni-popup ref="popup" type="dialog" >
			<uni-popup-dialog title="充值" @confirm="pay">
				<text>你确定要充值{{money}}元吗？</text>
			</uni-popup-dialog>
		</uni-popup>
		<uni-popup ref="otherpopup" type="dialog" >
			<uni-popup-dialog title="充值" @confirm="pay">
				<uni-easyinput  v-model="money" placeholder="请输入你要充值的金额" />
			</uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user:{},
				moneylist:[10,20,50,100,200],
				money:null
			}
		},
		methods: {
			record(){
				uni.navigateTo({
					url: '/pages/record/record',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			pay(){
				uni.navigateTo({
					url: '/pages/topUp/topUp?money='+this.money,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			other(){
				this.money=null
				this.$refs.otherpopup.open()
			},
			directional(index){
				this.money=this.moneylist[index]
				this.$refs.popup.open()
			}
		},
		onLoad() {
			if(uni.getStorageSync('token')){
				this.user=uni.getStorageSync('token')
				
			}
		},
		onShow() {
			if(uni.getStorageSync('token')){
				this.user=uni.getStorageSync('token')
				
			}
		}
	}
</script>

<style>

</style>
